package org.akomantoso.core.data;

import java.io.IOException;

import org.akomantoso.core.io.Input;
import org.akomantoso.core.io.Output;

/**
 * The group workProperties lists the properties that are characteristics of the FRBR Work level.
 * 
 * <pre>
 * 	<xsd:group name="workProperties">
 * 		<xsd:sequence>
 * 			<xsd:element ref="FRBRcountry"/>
 * 			<xsd:element ref="FRBRsubtype" minOccurs="0" maxOccurs="1"/>
 * 			<xsd:element ref="FRBRnumber" minOccurs="0" maxOccurs="1"/>
 * 			<xsd:element ref="FRBRname" minOccurs="0" maxOccurs="1"/>
 * 		</xsd:sequence>
 *	</xsd:group>
 * </pre>
 * 
 */
public abstract class WorkProperty extends CoreProperty{

	private final FRBRcountry _FRBRcountry = new FRBRcountry();

	public FRBRcountry getFRBRcountry() {
		return _FRBRcountry;
	}

	/**
	 * @see org.akomantoso.core.data.CoreProperty#writeExternal(org.akomantoso.core.io.Output)
	 */
	@Override
	public <T extends Output> void writeExternal(T out) throws IOException {
		super.writeExternal(out);
		_FRBRcountry.writeExternal(out);
	}

	/**
	 * @see org.akomantoso.core.data.CoreProperty#readExternal(org.akomantoso.core.io.Input)
	 */
	@Override
	public <T extends Input> void readExternal(T in) throws IOException {
		super.readExternal(in);
		if (FRBRcountry.ELEMENT.equals(in.getLocalName())) {
			_FRBRcountry.readExternal(in);
			in.readNextStartElement();
		}
	}
	
}